package com.hospital.controller;

import com.hospital.entity.Department;
import com.hospital.entity.Grade;
import com.hospital.service.intf.DepartmentService;
import com.hospital.vo.PageBean;
import com.hospital.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("/add.do")
    public R add(Department department){
        return departmentService.add(department);
    }

    @RequestMapping("/delete.do")
    public R delete(Integer id){
        return departmentService.delete(id);
    }

    @RequestMapping("/update.do")
    public R update(Department department){
        return departmentService.update(department);
    }

    @RequestMapping("/select.do")
    public R select(){
        return departmentService.select();
    }

    @RequestMapping("/selectPage.do")
    public PageBean selectPage(String department_name, int page, int limit){
        return departmentService.selectPage(department_name, page, limit);
    }

    @RequestMapping("/selectPageDepartmentEmployee.do")
    public PageBean selectPageDepartmentEmployee(String department_name, int page, int limit){
        return departmentService.selectPageDepartmentEmployee(department_name, page, limit);
    }
}
